using System;
using System.Text;

namespace LogicEngine
{
	/// <summary>
	/// 一个表达式计算器.
	/// </summary>
	public class Calculator<T> where T:IConvertible
	{
		public struct Token
		{
			public static byte TNum = 1;    //数值
			public static byte TVar = 2;    //变量
			public static byte OAdd = 11;   //操作符加
			public static byte OSub = 12;   //操作符减
			public static byte OTim = 21;   //操作符乘
			public static byte ODiv = 22;   //操作符除
			public static byte OExp = 31;   //指数操作符
			public static byte OLog = 32;   //对数操作符
			public static byte OLp  = 41;   //左括号
			public static byte ORp  = 42;   //右括号
			public static Token TNULL;

			public String Content {
				get;
				set;
			}
			public byte Type {
				get;
				set;
			}
			public T Value {
				get;
				set;
			}
		}
		public Calculator ()
		{
		}

		private Token NextToken(String content,ref int start)
		{
			while (start < content.Length && content[start] == ' ')
				start ++;
			int state = 0;
			StringBuilder sb = new StringBuilder ();
			while(start < content.Length)
			{
				switch(state)
				{
				case 0:
					break;
				case 1:
					break;
				case 2:
					break;
				case 3:
					break;
				case 4:
					break;
				case 5:
					break;
				}
			}

			return Token.TNULL;
		}

		public void ParseFormular(String content)
		{
		}


	}
}

